home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / animutil / kfast / kfast.lzh / KFAST / src / kfast.c < prev    next >
C/C++ Source or Header  |  1992-07-03  |  16KB  |  690 lines

  1. #define FRAMECOUNT 100
  2.  
  3. #include "skeleton.h"
  4. #include <proto/intuition.h>
  5. #include <proto/graphics.h>
  6. #include <graphics/gfxmacros.h>
  7. #include <graphics/display.h>
  8. #include <proto/exec.h>
  9. #include <exec/libraries.h>
  10. #include <exec/memory.h>
  11. #include <libraries/dosextens.h>
  12. #include <proto/req.h>
  13.  
  14.  
  15. struct IntuitionBase *IntuitionBase=NULL;
  16. struct GfxBase *GfxBase=NULL;
  17. struct Window *Win=NULL;
  18. struct ReBase *ReqBase=NULL;
  19. struct RastPort *RP;
  20. struct Screen *Scrn;
  21. struct TmpRas TRas;
  22. struct AreaInfo AInfo;
  23. SHORT *AreaBuffer=NULL;
  24. PLANEPTR RastSpace=NULL;
  25. int AreaSize=200;
  26.  
  27. struct Process *pr=NULL;
  28. APTR oldprocesswinptr;
  29.  
  30. /* Declare and initialize your NewScreen structure: */
  31. struct NewScreen NewScrn=
  32. {
  33.   0, 0, ScrnWidth, ScrnHeight, 2,
  34.   0, 1,
  35.   ScrnFlags,           /* ViewModes High-resolution, Interlaced */
  36.   CUSTOMSCREEN,    /* Type      Your own customized screen. */
  37.   NULL,            /* Font      Default font. */
  38.   "KFAST SCREEN",  /* Title     The screen' title. */
  39.   NULL, NULL
  40. };
  41.  
  42. /* Declare and initialize your NewWindow structure: */
  43. struct NewWindow NewWin=
  44. {
  45.   0, 10, ScrnWidth, ScrnHeight-10,
  46.   0, 1,
  47.   CLOSEWINDOW|VANILLAKEY|MOUSEBUTTONS|REFRESHWINDOW,
  48.   SIMPLE_REFRESH|WINDOWCLOSE|WINDOWDRAG|WINDOWDEPTH|WINDOWSIZING|
  49.    ACTIVATE|RMBTRAP|GIMMEZEROZERO|REPORTMOUSE,
  50.   NULL,          /* FirstGadget No gadgets connected to this window. */
  51.   NULL,          /* CheckMark   Use Intuition's default CheckMark. */
  52.   "KFAST",       /* Title Title of the window. */
  53.   NULL,          /* Screen      Connected to the Workbench Screen. */
  54.   NULL,          /* BitMap      No Custom BitMap. */
  55.   20, 20, ScrnWidth, ScrnHeight,
  56.   CUSTOMSCREEN   /* Type        Connected to the Workbench Screen. */
  57. };
  58.  
  59. obj_ptr framehead = NULL;
  60.  
  61. void Help(void)
  62. {
  63.  static char str[] = "\
  64.    Left mouse button draw line / Right mouse button ends line\n\
  65.    While the Left button is down you can draw freehand - SLOWLY\n\n\
  66.    SPACE/BCKSPC - scroll through ALL frames\n\
  67.    n/p - Next/Prev ENTERED frame\n\
  68.    f/l - First/Last frame (100 frames available)\n\n\
  69.    I/i - Toggle IMAGE flag for the frame / set draw mode to IMAGE\n\
  70.    S/s - Toggle SKELETON flag for the frame / set draw mode to SKELETON\n\
  71.    O/o - Toggle OUTLINE flag for the frame / set draw mode to OUTLINE\n\
  72.    x/X/y/Y - toggle deceleration/acceleration in x/y tweening\n\
  73.    0-3 - change IMAGE line color / shifted these change IMAGE fill color\n\
  74.    F - toggle Fill mode\n\n\
  75.    TAB - Change Display Mode (All, Images, or Entered)\n\
  76.    c/C - clear the current draw mode for a frame/clear everything everywhere\n\
  77.    a - Animate - generate intermediate image frames\n\
  78.    r/w - Read/Write a file\n\n\
  79.    h - Display this page";
  80.   
  81.     struct TRStructure trs;
  82.     
  83.     trs.Text = str;
  84.     trs.Controls = 0;
  85.     trs.Window = 0;
  86.     trs.MiddleText = 0;
  87.     trs.PositiveText = 0;
  88.     trs.NegativeText = "OK";
  89.     trs.Title = "KFAST Help";
  90.     trs.KeyMask = 0xFFFF;
  91.     trs.textcolor = 2;
  92.     trs.detailcolor = 3;
  93.     trs.blockcolor = 2;
  94.     trs.versionnumber = REQVERSION;
  95.     trs.Timeout = 60;
  96.     trs.AbortMask=0;
  97.     trs.rfu1=0;
  98.     TextRequest(&trs);
  99. }
  100.  
  101. char TitleInfo[127];
  102.  
  103. void Attributes(int display, int draw,int entry,int ilaw,int linec,int fillc)
  104. {
  105.     char displaytext[13],drawtext[13],entrytext[4],ilawtext[5],colortext[50];
  106.  
  107.     if(display==ENTRY)
  108.         strcpy(displaytext,"Entered");
  109.     else if(display==IMAGE)
  110.         strcpy(displaytext,"Images");
  111.     else
  112.         strcpy(displaytext,"All");
  113.  
  114.     colortext[0] = 0;
  115.             
  116.     if((draw&IMAGE)==IMAGE)
  117.     {
  118.         if((draw&FILL)!=0)
  119.         {
  120.             strcpy(drawtext,"Image w/Fill");
  121.             sprintf(colortext," LC:%d FC:%d",linec,fillc);
  122.         }
  123.         else
  124.         {
  125.             strcpy(drawtext,"Image");
  126.             sprintf(colortext," LC:%d",linec);
  127.         }
  128.     }
  129.     else if(draw==SKELETON)
  130.         strcpy(drawtext,"Skeleton");
  131.     else if(draw==XOUTLINE)
  132.         strcpy(drawtext,"Outline");
  133.     else
  134.         strcpy(drawtext,"???");
  135.     
  136.     strcpy(entrytext,"   ");    
  137.     if((entry&IMAGE)!=0)
  138.         entrytext[0] = 'I';
  139.     if((entry&SKELETON)!=0)
  140.         entrytext[1] = 'S';
  141.     if((entry&XOUTLINE)!=0)
  142.         entrytext[2] = 'O';
  143.         
  144.     strcpy(ilawtext,"    ");
  145.     if((ilaw&XACCEL)!=0)
  146.         ilawtext[0]='X';
  147.     if((ilaw&XDECEL)!=0)
  148.         ilawtext[1]='x';
  149.     if((ilaw&YACCEL)!=0)
  150.         ilawtext[2]='Y';
  151.     if((ilaw&YDECEL)!=0)
  152.         ilawtext[3]='y';
  153.     
  154.     
  155.     sprintf(TitleInfo,"DISPLAY:%s DRAWMODE:%s%s ENTERED:%s ILAW:%s",
  156.         displaytext,drawtext,colortext,entrytext,ilawtext);
  157.         
  158.     SetWindowTitles(Win,TitleInfo,(char *)-1);
  159. }
  160.  
  161. BOOL init(void)
  162. {
  163.   pr = (struct Process *)FindTask(NULL);
  164.   if(pr==NULL)
  165.       return(FALSE);
  166.  
  167.   oldprocesswinptr = pr->pr_WindowPtr;
  168.  
  169.   IntuitionBase = (struct IntuitionBase *)
  170.     OpenLibrary( "intuition.library", 0 );
  171.   
  172.   if( IntuitionBase == NULL )
  173.     return(FALSE);
  174.  
  175.   GfxBase = (struct GfxBase *)
  176.     OpenLibrary( "graphics.library", 0 );
  177.   
  178.   if( GfxBase == NULL )
  179.     return(FALSE);
  180.  
  181.   ReqBase = (struct ReqBase *)
  182.     OpenLibrary( "req.library", REQVERSION );
  183.     
  184.   if( ReqBase == NULL )
  185.     return(FALSE);
  186.  
  187.   Scrn = OpenScreen(&NewScrn);
  188.   if(Scrn==NULL)
  189.       return(FALSE);
  190.  
  191.   NewWin.Screen = Scrn;
  192.  
  193.   Win = (struct Window *) OpenWindow( &NewWin );
  194.   
  195.   if(Win == NULL)
  196.     return(FALSE);
  197.  
  198.   pr->pr_WindowPtr = (APTR)Win;
  199.  
  200.   RP = Win->RPort;
  201.  
  202.   AreaSize = AreaSize + MEM_BLOCKSIZE - (AreaSize%MEM_BLOCKSIZE);
  203.   AreaBuffer = (SHORT *)malloc(5*AreaSize);
  204.   if(AreaBuffer==NULL) return(FALSE);
  205.  
  206.   RastSpace = (PLANEPTR)AllocRaster(ScrnWidth,ScrnHeight);
  207.   if(RastSpace==NULL) return(FALSE);
  208.   
  209.   InitArea(&AInfo,AreaBuffer,AreaSize);
  210.   RP->AreaInfo = &AInfo;
  211.   RP->TmpRas=(struct TmpRas *)InitTmpRas(&TRas,RastSpace,RASSIZE(ScrnWidth,ScrnHeight));
  212.  
  213.   BNDRYOFF( RP );
  214.  
  215.   new();
  216.  
  217.   return(TRUE);
  218. }
  219.  
  220. void fini(void)
  221. {
  222.  /* not necessary with Lattice managing the Pool - and slow too
  223.   if(framehead!=NULL)
  224.   {
  225.     new();
  226.       free(framehead,sizeof(struct object));
  227.   }
  228.   */
  229.   
  230.   if(AreaBuffer!=NULL)
  231.       free(AreaBuffer,5*AreaSize);
  232.     
  233.   if(RastSpace!=NULL)
  234.     FreeRaster( RastSpace, ScrnWidth, ScrnHeight );
  235.     
  236.   if(pr!=NULL)
  237.       pr->pr_WindowPtr = oldprocesswinptr;
  238.     
  239.   if(Win!=NULL)
  240.     CloseWindow( Win );
  241.  
  242.   if(Scrn!=NULL)
  243.     CloseScreen( Scrn );
  244.  
  245.   if(IntuitionBase!=NULL)
  246.     CloseLibrary( IntuitionBase );
  247.  
  248.   if(GfxBase!=NULL)
  249.     CloseLibrary( GfxBase );
  250.  
  251.   if(ReqBase!=NULL)
  252.     CloseLibrary( ReqBase );
  253.  
  254.   exit(0);  
  255. }
  256.  
  257. void main(void)
  258. {
  259.   BOOL close_me, refresh, newline, adjust, fixc;
  260.   int i,drawmode,linec,fillc;
  261.   struct IntuiMessage IMsg,*Msg;
  262.   obj_ptr currentframe,firstframe, lastframe, temp;
  263.   line_ptr lastline=NULL;
  264.  
  265.   if(init()!=TRUE) fini();
  266.  
  267.   firstframe = makeobject();
  268.   firstframe->entry = IMAGE;
  269.   lastframe = makeobject();
  270.   lastframe->entry = IMAGE;
  271.   addobject(firstframe,lastframe,FRAMECOUNT);
  272.   addchain(framehead,firstframe);
  273.   lastframe = locateframe(lastframe);
  274.   firstframe = locateframe(firstframe);
  275.     
  276.   currentframe = firstframe;
  277.  
  278.   /* We have opened the window, and everything seems to be OK. */
  279.  
  280.   Help();
  281.  
  282.   close_me = FALSE;
  283.   refresh = FALSE;
  284.   newline = TRUE;
  285.   drawmode = IMAGE;
  286.   adjust = FALSE;
  287.   fixc = FALSE;
  288.   linec = 1;
  289.   fillc = 3;
  290.  
  291.   Attributes(dispmode,drawmode,currentframe->framedown->entry,
  292.              currentframe->framedown->ilaw,linec,fillc);
  293.   Attributes(dispmode,drawmode,currentframe->framedown->entry,
  294.              currentframe->framedown->ilaw,linec,fillc);
  295.  
  296.   /* Stay in the while loop until the user has selected the Close window */
  297.   /* gadget: */
  298.   while( close_me == FALSE )
  299.   {
  300.     /* Wait until we have recieved a message: */
  301.     Wait( 1 << Win->UserPort->mp_SigBit );
  302.  
  303.     /* As long as we can collect messages successfully we stay in the */
  304.     /* while-loop: */
  305.     while(Msg = (struct IntuiMessage *) GetMsg(Win->UserPort))
  306.     {
  307.       /* After we have successfully collected the message we can read */
  308.       /* it, and save any important values which we maybe want to check */
  309.       /* later: */
  310.       memcpy((char *)&IMsg,(char *)Msg,sizeof(struct IntuiMessage));
  311.  
  312.       IMsg.MouseY -= 12; /* correct for GimmeZeroZero */
  313.       
  314.       /* After we have read it we reply as fast as possible: */
  315.       /* REMEMBER! Do never try to read a message after you have replied! */
  316.       /* (Some other process has maybe changed it.) */
  317.       ReplyMsg( (struct Message *)Msg );
  318.  
  319.       /* Check which IDCMP flag was sent: */
  320.       switch( IMsg.Class )
  321.       {
  322.         case CLOSEWINDOW:  /* The user selected the Close window gadget! */
  323.                close_me=TRUE;
  324.                break;
  325.         
  326.     case MOUSEMOVE:
  327.         if(lastline==NULL)
  328.             break;
  329.         i = lastline->number - 1;
  330.         if(i>0)
  331.         {
  332.             if(
  333.               (lastline->pts->p[i][1]-lastline->pts->p[i-1][1])*
  334.               (IMsg.MouseX-lastline->pts->p[i-1][0])-
  335.               (lastline->pts->p[i][0]-lastline->pts->p[i-1][0])*
  336.               (IMsg.MouseY-lastline->pts->p[i-1][1])==0)
  337.             {
  338.                 lastline->pts->p[i][0] = IMsg.MouseX;
  339.                 lastline->pts->p[i][1] = IMsg.MouseY;
  340.             }
  341.             else
  342.             {
  343.                 addpoint(lastline,IMsg.MouseX,IMsg.MouseY);
  344.             }
  345.         }
  346.         else
  347.         {
  348.             addpoint(lastline,IMsg.MouseX,IMsg.MouseY);
  349.         }
  350.         
  351.         DrawObject(lastline,currentframe->framedown->offset[0],
  352.                currentframe->framedown->offset[1]);
  353.          break;
  354.         case MOUSEBUTTONS: /* The user pressed/released a mouse button. */
  355.                /* We shall now check wich button, and if it was pressed */
  356.                /* or released: */
  357.                switch( IMsg.Code )
  358.                {
  359.                  case SELECTDOWN: /* Left button pressed. */
  360.                        if(((currentframe->framedown->entry&IMAGE)!=0) && ((drawmode&IMAGE)!=0))
  361.                {
  362.             ModifyIDCMP(Win,NewWin.IDCMPFlags|MOUSEMOVE);
  363.  
  364.             if(currentframe->framedown->image==NULL)
  365.             {
  366.                 lastline = addpoint(NULL,IMsg.MouseX,IMsg.MouseY);
  367.                 currentframe->framedown->image = lastline;
  368.                 if((drawmode&FILL)!=0)
  369.                     lastline->fillc = fillc;
  370.                 lastline->linec = linec;
  371.                 newline = FALSE;
  372.             }
  373.             else if(newline==TRUE)
  374.             {
  375.                 lastline = addpoint(NULL,IMsg.MouseX,IMsg.MouseY);
  376.                 appendline(currentframe->framedown->image,lastline);
  377.                 if((drawmode&FILL)!=0)
  378.                     lastline->fillc = fillc;
  379.                 lastline->linec = linec;
  380.                 newline=FALSE;
  381.             }
  382.             else
  383.             {
  384.                 lastline = appendpoint(currentframe->framedown->image,
  385.                     IMsg.MouseX,IMsg.MouseY);
  386.             }
  387.  
  388.                }
  389.                        else if(((currentframe->framedown->entry&SKELETON)!=0) && ((drawmode&SKELETON)!=0))
  390.                {
  391.             lastline = 
  392.                 addpoint(currentframe->framedown->skeleton,IMsg.MouseX,IMsg.MouseY);
  393.             if(currentframe->framedown->skeleton==NULL)
  394.             {
  395.                 lastline->linec = 2;
  396.                 currentframe->framedown->skeleton = lastline;
  397.             }
  398.                }
  399.                        else if(((currentframe->framedown->entry&XOUTLINE)!=0) && ((drawmode&XOUTLINE)!=0))
  400.                {
  401.             lastline = 
  402.                 addpoint(currentframe->framedown->outline,IMsg.MouseX,IMsg.MouseY);
  403.             if(currentframe->framedown->outline==NULL)
  404.             {
  405.                 lastline->linec = 3;
  406.                 currentframe->framedown->outline= lastline;
  407.             }    
  408.                }
  409.                break;
  410.          case SELECTUP:
  411.              if((drawmode&IMAGE)!=0)
  412.                  ModifyIDCMP(Win,NewWin.IDCMPFlags);
  413.             lastline = NULL;
  414.             if((drawmode&FILL)!=0)
  415.             {
  416.                 EraseFrame(currentframe);
  417.             }
  418.             refresh = TRUE;
  419.              break;
  420.                  case MENUDOWN:   /* Right button pressed. */
  421.              newline = TRUE;
  422.             
  423.                         break;
  424.                }
  425.                break;
  426.         case VANILLAKEY:     /* The user pressed/released a key! */
  427.                /* Print out the translated keycode (as dec. and hex.): */
  428.  
  429.            switch(IMsg.Code)
  430.            {
  431.          case 'f':
  432.              EraseFrame(currentframe);
  433.             currentframe = firstframe;
  434.             refresh = TRUE;
  435.             newline = TRUE;
  436.             break;
  437.          case 'l':
  438.              EraseFrame(currentframe);
  439.             currentframe = lastframe;
  440.             refresh = TRUE;
  441.             newline = TRUE;
  442.             break;
  443.          case 'n':
  444.              EraseFrame(currentframe);
  445.             currentframe = findtype(currentframe->framedown->next,0,&i);
  446.              if(currentframe==NULL)
  447.                 currentframe = firstframe;
  448.             else
  449.                 currentframe = locateframe(currentframe);
  450.             refresh = TRUE;
  451.             newline = TRUE;
  452.             break;
  453.          case 'p':
  454.              EraseFrame(currentframe);
  455.             currentframe = findtypeback(currentframe->framedown->prev,0,&i);
  456.              if(currentframe==NULL)
  457.                 currentframe = lastframe;
  458.             else
  459.                 currentframe = locateframe(currentframe);
  460.             refresh = TRUE;
  461.             newline = TRUE;
  462.             break;
  463.          case 'I':
  464.              if(currentframe!=firstframe)
  465.                 currentframe->framedown->entry^=IMAGE;
  466.             adjust = TRUE;
  467.             newline = TRUE;
  468.             break;
  469.          case 'i':
  470.              drawmode = IMAGE;
  471.             adjust = TRUE;
  472.             newline = TRUE;
  473.             break;
  474.          case 'S':
  475.              currentframe->framedown->entry^=SKELETON;
  476.             adjust = TRUE;
  477.             break;
  478.          case 's':
  479.              drawmode = SKELETON;
  480.             adjust = TRUE;
  481.             break;
  482.          case 'O':
  483.              currentframe->framedown->entry^=XOUTLINE;
  484.             adjust = TRUE;
  485.             newline = TRUE;
  486.             break;
  487.          case 'o':
  488.              drawmode = XOUTLINE;
  489.             adjust = TRUE;
  490.             break;
  491.          case 'c':
  492.              EraseFrame(currentframe);
  493.             if((drawmode&IMAGE)!=0)
  494.             {
  495.                 deleteline(currentframe->framedown->image);
  496.                 currentframe->framedown->image = NULL;
  497.             }
  498.             else if((drawmode&SKELETON)!=0)
  499.             {
  500.                 deleteline(currentframe->framedown->skeleton);
  501.                 currentframe->framedown->skeleton = NULL;
  502.             }
  503.             else if((drawmode&XOUTLINE)!=0)
  504.             {
  505.                 deleteline(currentframe->framedown->outline);
  506.                 currentframe->framedown->outline = NULL;
  507.             }
  508.             lastline = NULL;
  509.             refresh = TRUE;
  510.             break;
  511.          case 'C':
  512.              EraseFrame(currentframe);
  513.             new();
  514.             firstframe = makeobject();
  515.             firstframe->entry = IMAGE;
  516.             lastframe = makeobject();
  517.             lastframe->entry = IMAGE;
  518.             addobject(firstframe,lastframe,FRAMECOUNT);
  519.             addchain(framehead,firstframe);
  520.             lastframe = locateframe(lastframe);
  521.             firstframe = locateframe(firstframe);
  522.             currentframe = firstframe;
  523.             adjust = TRUE;
  524.             break;
  525.          case ' ':
  526.              EraseFrame(currentframe);
  527.              if(currentframe->next!=NULL)
  528.                 currentframe = currentframe->next;
  529.             else
  530.                 currentframe = firstframe;
  531.             refresh = TRUE;
  532.             newline = TRUE;
  533.             break;
  534.          case   8:/* backspace */
  535.              EraseFrame(currentframe);
  536.              if(currentframe->prev!=NULL)
  537.                 currentframe = currentframe->prev;
  538.             else
  539.                 currentframe = lastframe;
  540.             refresh = TRUE;
  541.             newline = TRUE;
  542.             break;
  543.         case 'a':
  544.              EraseFrame(currentframe);
  545.             animate(firstframe->framedown);
  546.             refresh = TRUE;
  547.             break;
  548.         case 'x':
  549.             currentframe->framedown->ilaw^=XDECEL;
  550.             adjust = TRUE;
  551.             break;
  552.         case 'X':
  553.             currentframe->framedown->ilaw^=XACCEL;
  554.             adjust = TRUE;
  555.             break;
  556.         case 'y':
  557.             currentframe->framedown->ilaw^=YDECEL;
  558.             adjust = TRUE;
  559.             break;
  560.         case 'Y':
  561.             currentframe->framedown->ilaw^=YACCEL;
  562.             adjust = TRUE;
  563.             break;
  564.         case 'w':
  565.             if(filerequest()!=FALSE)
  566.                 save();
  567.             break;
  568.         case 'r':
  569.             EraseFrame(currentframe);
  570.             if(filerequest()!=FALSE)
  571.             {
  572.                 load();
  573.             }
  574.             currentframe = framehead;
  575.             firstframe = framehead;
  576.             lastframe = framehead;
  577.             while(lastframe->next!=NULL)
  578.                 lastframe = lastframe->next;
  579.             refresh = TRUE;
  580.             newline = TRUE;
  581.             break;
  582.         case 'h':
  583.             Help();
  584.             break;
  585.         case '\t':
  586.             EraseFrame(currentframe);
  587.             if(dispmode==IMAGE)
  588.                 dispmode = ENTRY;
  589.             else if(dispmode==ENTRY)
  590.                 dispmode = ALL;
  591.             else
  592.                 dispmode = IMAGE;
  593.             refresh=TRUE;
  594.             break;
  595.         case 'F':
  596.             drawmode ^=FILL;
  597.             fixc = TRUE;
  598.             break;
  599.         case '0':
  600.         case '1':
  601.         case '2':
  602.         case '3':
  603.             linec = IMsg.Code - '0';
  604.             fixc = TRUE;
  605.             break;
  606.         case ')':
  607.             fillc = 0;
  608.             fixc = TRUE;
  609.             break;
  610.         case '!':
  611.             fillc = 1;
  612.             fixc = TRUE;
  613.             break;
  614.         case '@':
  615.             fillc = 2;
  616.             fixc = TRUE;
  617.             break;
  618.         case '#':
  619.             fillc = 3;
  620.             fixc = TRUE;
  621.             break;
  622.         case '>':
  623.             temp = currentframe;
  624.             do
  625.             {
  626.                 EraseFrame(temp);
  627.                 temp = temp->next;
  628.                 if(temp==NULL)
  629.                     temp = firstframe;
  630.                 DrawFrame(temp);
  631.             }
  632.             while(currentframe!=temp);
  633.             break;
  634.         default:
  635.             break;
  636.            }
  637.                
  638.                break;
  639.     case REFRESHWINDOW:
  640.         BeginRefresh(Win);
  641.         DrawFrame(currentframe);
  642.         EndRefresh(Win,TRUE);    
  643.         break;
  644.       }
  645.  
  646.       if(fixc==TRUE)
  647.       {
  648.         if(((drawmode&IMAGE)!=0) && (newline==FALSE))
  649.         {
  650.             lastline = currentframe->framedown->image;
  651.             if(lastline!=NULL)
  652.             {
  653.                 while(lastline->next!=NULL)
  654.                     lastline = lastline->next;
  655.             
  656.                 lastline->linec = linec;
  657.                 if((drawmode&FILL)!=0)
  658.                     lastline->fillc = fillc;
  659.                 else
  660.                     lastline->fillc = 0;
  661.                 EraseFrame(currentframe);
  662.                 
  663.                 refresh = TRUE;
  664.             }
  665.         }
  666.         adjust = TRUE;
  667.         fixc = FALSE;
  668.       }      
  669.       if(adjust==TRUE  || refresh==TRUE)
  670.       {
  671.           Attributes(dispmode,drawmode,currentframe->framedown->entry,
  672.              currentframe->framedown->ilaw,linec,fillc);
  673.     adjust = FALSE;
  674.       }     
  675.       if(refresh==TRUE)
  676.       {
  677.     DrawFrame(currentframe);
  678.     
  679.     refresh = FALSE;
  680.       }
  681.     }
  682.   }
  683.  
  684.   fini();
  685. }
  686.  
  687.  
  688.  
  689.  
  690.